package com.example.springsecurityauth2clientalipaylogin.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.oauth2.client.registration.ClientRegistrationRepository;
import org.springframework.security.web.SecurityFilterChain;

/**
 * @auth 罗俊华
 * @Date 2022/9/4 9:40 下午
 */
@EnableWebSecurity
@Configuration
public class SecurityConfig {


/*    @Autowired
    private ClientRegistrationRepository clientRegistrationRepository;*/

    @Bean
    public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
        http
                .authorizeHttpRequests(authorize -> authorize
                        .anyRequest().authenticated()
                )
                .oauth2Login(oauth2 -> {

                        }
                        /*.authorizationEndpoint(authorization ->
                                        authorization*//*.authorizationRequestRepository()*//*

                         *//*.authorizationRequestResolver(
                                        authorizationRequestResolver(this.clientRegistrationRepository)
                                )*//*
                        )*/
                );
        return http.build();
    }
}
